Skip to content

feat: Require Go 1.26 and use new(expr) for pointer literals - #4481

Open
ajayk wants to merge 7 commits into
google:masterfrom
ajayk:go-1.26
Open

feat: Require Go 1.26 and use new(expr) for pointer literals#4481
ajayk wants to merge 7 commits into
google:masterfrom
ajayk:go-1.26

Conversation

@ajayk

@ajayk ajayk commented Aug 23, 2026

Copy link
Copy Markdown

Bump go.mod to 1.26 per the N-1 support policy (Go 1.27 is current) and replace Ptr() with the new(v) builtin across tests.

  Bump go.mod to 1.26 per the N-1 support policy (Go 1.27 is current) and replace Ptr() with the new(v) builtin across tests.
@gmlewis

gmlewis commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

@ajayk - please read step 4 of CONTRIBUTING.md and run the scripts locally to fix all test and linter errors, then push the changes to this PR before we can proceed.

  Bump go.mod to 1.26 per the N-1 support policy (Go 1.27 is current) and replace Ptr() with the new(v) builtin across tests.
@ajayk

ajayk commented Aug 23, 2026

Copy link
Copy Markdown
Author

@ajayk - please read step 4 of CONTRIBUTING.md and run the scripts locally to fix all test and linter errors, then push the changes to this PR before we can proceed.

addressed them sorry about this !

➜  go-github git:(go-1.26) script/fmt.sh
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
➜  go-github git:(go-1.26) script/test.sh
Testing modules

✔ .                                        [ PASS ]
✔ example                                  [ PASS ]
✔ otel                                     [ PASS ]
✔ scrape                                   [ PASS ]
✔ tools                                    [ PASS ]
✔ tools/check-structfield-settings         [ PASS ]
✔ tools/extraneousnew                      [ PASS ]
✔ tools/fmtpercentv                        [ PASS ]
✔ tools/paramcheck                         [ PASS ]
✔ tools/redundantptr                       [ PASS ]
✔ tools/sliceofpointers                    [ PASS ]
✔ tools/structfield                        [ PASS ]
----------------------------
Testing: issues found in 0 module directories.
--------------------------------------------
➜  go-github git:(go-1.26) script/lint.sh
Linting modules

✔ .                                        [ PASS ]
✔ example                                  [ PASS ]
✔ otel                                     [ PASS ]
✔ scrape                                   [ PASS ]
✔ tools                                    [ PASS ]
✔ tools/check-structfield-settings         [ PASS ]
✔ tools/extraneousnew                      [ PASS ]
✔ tools/fmtpercentv                        [ PASS ]
✔ tools/paramcheck                         [ PASS ]
✔ tools/redundantptr                       [ PASS ]
✔ tools/sliceofpointers                    [ PASS ]
✔ tools/structfield                        [ PASS ]
Validating generated files

✔ Generated files are up to date
----------------------------
Linting: issues found in 0 module directories.
--------------------------------------------

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Aug 23, 2026
@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.13433% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.52%. Comparing base (34cec4f) to head (808125a).

Files with missing lines Patch % Lines
github/github.go 50.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4481      +/-   ##
==========================================
- Coverage   98.53%   98.52%   -0.01%     
==========================================
  Files         195      195              
  Lines       17691    17685       -6     
==========================================
- Hits        17431    17424       -7     
- Misses        260      261       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis

gmlewis commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

I'm surprised the the Codecov report actually dropped in with this PR, but the bulk of the changes are for deprecated functions that are fixed with go:fix anyway, so I think we can safely ignore Codecov for this PR.

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @ajayk!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear - @Not-Dhananjay-Mishra

Comment thread test/integration/users_test.go Outdated

@alexandear alexandear left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update all occurrences of Ptr with new:

❯ rg "Ptr\(" -c
CONTRIBUTING.md:4
tools/redundantptr/redundantptr.go:2
scrape/apps_test.go:2
tools/redundantptr/testdata/src/has-warnings/github.go:9
github/github-iterators.go:246
tools/redundantptr/testdata/src/no-warnings/github.go:9
README.md:2
github/github-stringify_test.go:976
github/gen-iterators.go:1
github/gen-stringify-test.go:11
github/github.go:2
github/github_test.go:4
github/doc.go:2

Comment thread go.mod
Comment thread go.mod
Comment thread github/github.go
@ajayk

ajayk commented Aug 25, 2026

Copy link
Copy Markdown
Author
  go-github git:(go-1.26) date
Tue Aug 25 16:33:15 PDT 2026
➜  go-github git:(go-1.26) script/lint.sh
Linting modules

✔ .                                        [ PASS ]
✔ example                                  [ PASS ]
✔ otel                                     [ PASS ]
✔ scrape                                   [ PASS ]
✔ tools                                    [ PASS ]
✔ tools/check-structfield-settings         [ PASS ]
✔ tools/extraneousnew                      [ PASS ]
✔ tools/fmtpercentv                        [ PASS ]
✔ tools/paramcheck                         [ PASS ]
✔ tools/redundantptr                       [ PASS ]
✔ tools/sliceofpointers                    [ PASS ]
✔ tools/structfield                        [ PASS ]
Validating generated files

✔ Generated files are up to date
----------------------------
Linting: issues found in 0 module directories.
--------------------------------------------
➜  go-github git:(go-1.26) script/fmt.sh
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
WARN [formatter] gofumpt: `extra-rules` is deprecated, please use `extra.group-params` instead.
➜  go-github git:(go-1.26) script/test.sh
Testing modules

✔ .                                        [ PASS ]
✔ example                                  [ PASS ]
✔ otel                                     [ PASS ]
✔ scrape                                   [ PASS ]
✔ tools                                    [ PASS ]
✔ tools/check-structfield-settings         [ PASS ]
✔ tools/extraneousnew                      [ PASS ]
✔ tools/fmtpercentv                        [ PASS ]
✔ tools/paramcheck                         [ PASS ]
✔ tools/redundantptr                       [ PASS ]
✔ tools/sliceofpointers                    [ PASS ]
✔ tools/structfield                        [ PASS ]
----------------------------
Testing: issues found in 0 module directories.

@gmlewis

gmlewis commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Thank you, @Not-Dhananjay-Mishra!
@alexandear - have all your concerns been addressed?

Comment thread tools/redundantptr/go.mod Outdated
Comment thread github/github_test.go Outdated
@gmlewis

gmlewis commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Closing and reopening to kick GitHub.

@gmlewis gmlewis closed this Aug 26, 2026
@gmlewis gmlewis reopened this Aug 26, 2026
# Conflicts:
#	github/github-stringify_test.go
#	github/repos_keys_test.go
#	github/users_keys_test.go
#	github/users_ssh_signing_keys_test.go
#	test/integration/users_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NeedsReview PR is awaiting a review before merging. waiting for reply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants